home *** CD-ROM | disk | FTP | other *** search
- /*
-
- NotPPC.c
-
- Source code for NotPPC application to provide a warning
- when PowerMac Native Mode application is launched on a
- 68K machine.
-
- Note: This module has been observed to put up only a partial
- error message when launched under System 7.5. It does however
- look find under System 7.1.
-
- */
-
- #include <dialogs.h>
- #include <QuickDraw.h>
- #include <Dialogs.h>
- #include <Windows.h>
- #include <Resources.h>
- #include <Memory.h>
- #include "NotPPC.h"
-
- // When using 3.3.1 or newer MPW these are no longer in Dialogs.h, so we put them here. If you're using an
- // older MPW then comment out the following lines.
- pascal void CouldAlert(short alertID)
- = 0xA989;
- pascal void FreeAlert(short alertID)
- = 0xA98A;
-
-
- void main ()
- {
- short itemHit;
- AlertTHndl theAlertTemplate;
- Handle theDITLHandle;
- Handle theMessageHandle;
- Boolean canAlert;
-
- InitGraf ((Ptr)&qd.thePort);
- InitWindows ();
- InitDialogs (NULL);
-
- /* set cursor to an arrow */
- SetCursor (&qd.arrow);
-
- /* pre-flight everything first */
- theAlertTemplate = (AlertTHndl)GetResource ('ALRT', RESOURCE_ID); /* is the ALRT resource around? */
- theDITLHandle = GetResource ('DITL', (*theAlertTemplate)->itemsID); /* how about the DITL? */
- theMessageHandle = GetResource ('STR ', RESOURCE_ID); /* check the STR resource, too */
-
- CouldAlert (RESOURCE_ID); /* is there enough memory to handle the alert? */
- canAlert = (ResError() == noErr) && (MemError() == noErr);
- FreeAlert (RESOURCE_ID); /* free the memory */
-
- if ((theAlertTemplate) || (theDITLHandle) || (theMessageHandle) || (canAlert))
- {
- /* Success at last... */
- HLock( theMessageHandle );
- ParamText (*(theMessageHandle), "", "", ""); /* use the loaded STR resource to replace ^0 in alert's DITL */
- itemHit = Alert (RESOURCE_ID, nil); /* run the alert */
- }
- else
- {
- /* give some indication we're hosed... */
- SysBeep(2);
- }
- }
-
-
-